#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QtNetwork/QTcpSocket>
#include <QTimer>

namespace Ui {
class Chi;
}

class Chi : public QWidget
{
    Q_OBJECT
    
public:
    explicit Chi(QWidget *parent = 0);
    ~Chi();
    
private slots:
    void on_txtCommand_returnPressed();
    void on_pushButton_clicked();
    void read_data();
    void connected();
    void disconnected();
    void error();
    void myLineEditKeyPressed(int num);
    void myLineEditCtrlComboPressed(QString key);
    void updateSleep();
    void autoCure();

private:
    Ui::Chi *ui;
    QTcpSocket *tcpSocket;
    bool formatRead;
    QString readData;
    QTimer *timer;
    QTimer *autoTimer;
    int sleepTimer;
    bool sleepTimerOn;
    QString defaultColor;

    void connectToServer();
    void disconnectFromServer();
    void showDebug();
    void moveCursorToEnd();
    void printCommands();
    void setFontSize(int size);
    void appendHtml(QString str, QString col, bool bold, bool rawHtml);
    void setTargetHealth(QString line);
    bool combatHilite(QString str);
};

#endif // WIDGET_H
